package com.mineplatform.iservice;

import java.io.IOException;
import java.util.List;

import org.springframework.web.multipart.MultipartFile;

import com.mineplatform.domain.Consultation;
import com.mineplatform.domain.M_Reply;
import com.mineplatform.domain.M_User;
import com.mineplatform.exception.AdminCannotRegistException;
import com.mineplatform.exception.AgeInvalidException;
import com.mineplatform.exception.AvatarNullException;
import com.mineplatform.exception.AvatarSizeTooLargeException;
import com.mineplatform.exception.EducationInvalidException;
import com.mineplatform.exception.FileNameInvalidException;
import com.mineplatform.exception.FileNameNullOrEmptyException;
import com.mineplatform.exception.FileTypeInvalidException;
import com.mineplatform.exception.GenderInvalidException;
import com.mineplatform.exception.MineIdNullOrEmptyException;
import com.mineplatform.exception.MineNotExistException;
import com.mineplatform.exception.PriceNullOrEmptyException;
import com.mineplatform.exception.ReplyContentNullOrEmptyException;
import com.mineplatform.exception.TokenDisableException;
import com.mineplatform.exception.TokenNotExistException;
import com.mineplatform.exception.UserExistException;
import com.mineplatform.exception.UserIdNullOrEmptyException;
import com.mineplatform.exception.UserNameFormatInvalidException;
import com.mineplatform.exception.UserNameNullOrEmptyException;
import com.mineplatform.exception.UserNotExistException;
import com.mineplatform.exception.UserPasswordErrorException;
import com.mineplatform.exception.UserPasswordNullOrEmptyException;
import com.mineplatform.domain.PraiseData;
import com.mineplatform.domain.ReplyContainsUserInfo;
import com.mineplatform.domain.ReplyContainsUserInfoWithMine;
import com.mineplatform.exception.TokenNullOrEmptyException;

public interface IM_UserService {
	M_User findById(String Id);

	M_User findByUserName(String userName);
	
	M_User findUserByUserName(String userName) throws UserNotExistException ;
	
	M_User findUserByUserId(String userId) throws UserNotExistException ;

	String registUser(String userName, String userPassword, Integer userType, Boolean Autoactive)
			throws UserNameNullOrEmptyException, UserPasswordNullOrEmptyException, UserExistException, UserNameFormatInvalidException,AdminCannotRegistException;

	void additionalInfo(String token, String nickname, Integer gender, String avatar, Integer education, Integer age,
			String profession, String company, String jobtitle, String direction, String workexperience, Integer price)
			throws TokenNullOrEmptyException, TokenNotExistException, TokenDisableException, GenderInvalidException,
			EducationInvalidException, AgeInvalidException, UserNotExistException;

	void activeUser(String userName) throws UserNotExistException;

	String auth(String userName, String userPassword) throws UserNotExistException, UserNameNullOrEmptyException,
			UserPasswordNullOrEmptyException, UserPasswordErrorException;

	void signOut(String token) throws TokenNullOrEmptyException, TokenNotExistException;

	Boolean exist(String username, Boolean active) throws UserNameNullOrEmptyException;

	void resetPassword(String username, String oldpassword, String newpassword) throws UserNameNullOrEmptyException,
			UserPasswordNullOrEmptyException, UserNotExistException, UserPasswordErrorException;

	String setAvatar(String token, MultipartFile avatar, String path)
			throws TokenNullOrEmptyException, TokenNotExistException, TokenDisableException, UserNotExistException,
			AvatarNullException, AvatarSizeTooLargeException, FileNameNullOrEmptyException, FileNameInvalidException,
			FileTypeInvalidException, IllegalStateException, IOException;

	M_User findByToken(String token)
			throws UserNotExistException, TokenDisableException, TokenNotExistException, TokenNullOrEmptyException;

	String reply(String token, String mineid, String content) throws TokenNullOrEmptyException, TokenNotExistException, TokenDisableException, UserNotExistException, MineIdNullOrEmptyException, ReplyContentNullOrEmptyException, MineNotExistException;

	PraiseData praise(String token, String mineid) throws MineNotExistException, UserNotExistException, MineIdNullOrEmptyException, TokenDisableException, TokenNullOrEmptyException, TokenNotExistException;

	List<ReplyContainsUserInfo> getMyreplies(String token) throws TokenNullOrEmptyException, TokenDisableException, TokenNotExistException, UserNotExistException;

	List<M_User> findExperts(Integer top, String keywords);

	M_User findExpert(String userid) throws UserNotExistException, UserIdNullOrEmptyException;

	List<Consultation> getconsultations(String userid) throws  UserNotExistException;

	void setexpertprice(String userid, Integer price) throws UserNotExistException, PriceNullOrEmptyException;

	void forgetpassword(String username, String newpassword)throws UserNameNullOrEmptyException,
	UserPasswordNullOrEmptyException, UserNotExistException, UserPasswordErrorException;

	Boolean ispraise(String mineid, String userid) throws MineIdNullOrEmptyException, UserNotExistException, MineNotExistException, UserIdNullOrEmptyException;

	String uploadmineimage(String token, MultipartFile mineimage, String path) throws TokenNullOrEmptyException, TokenNotExistException, TokenDisableException, UserNotExistException, AvatarNullException, AvatarSizeTooLargeException, FileNameNullOrEmptyException, FileNameInvalidException, FileTypeInvalidException, IllegalStateException, IOException;

	List<ReplyContainsUserInfoWithMine> findListWithMineByUserId(String token)throws TokenNullOrEmptyException, TokenDisableException, TokenNotExistException, UserNotExistException;
}

